import api from './index'

const studentGuidanceApi = {
  my: (params) => api.get('/student-guidance/my', { params }),
  list: (params) => api.get('/student-guidance/list', { params }),
  getById: (id) => api.get(`/student-guidance/${id}`),
  create: (data) => api.post('/student-guidance', data),
  update: (id, data) => api.put(`/student-guidance/${id}`, data),
  delete: (id) => api.delete(`/student-guidance/${id}`),
  review: (id, data) => api.post(`/student-guidance/${id}/review`, data),
  stats: (params) => api.get('/student-guidance/stats', { params }),

  // attachments
  uploadAchievementAttachment: (achievementId, file, fileType = '附件') => {
    const fd = new FormData()
    fd.append('file', file)
    fd.append('fileType', fileType)
    return api.post(`/student-guidance/achievements/${achievementId}/attachments`, fd, {
      headers: { 'Content-Type': 'multipart/form-data' }
    })
  },
  listAchievementAttachments: (achievementId) => api.get(`/student-guidance/achievements/${achievementId}/attachments`),
  deleteAttachment: (attachmentId) => api.delete(`/student-guidance/attachments/${attachmentId}`)
}

export default studentGuidanceApi 